package com.base.cn.platform.os.controller.planTools;

import com.base.cn.platform.os.common.AdminBaseController;
import com.base.cn.platform.os.entity.planTools.OverallAdvert;
import com.base.cn.platform.os.service.manage.planTools.OverallAdvertService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 * 全局广告Controller
 *
 * @author lxr
 * @create 2020-06-28-17:46
 */
@Controller
@Slf4j
@RequestMapping("/admin/planTools/overallAdvert")
public class AdminOverallAdvertController extends AdminBaseController {

    @Autowired
    private OverallAdvertService overallAdvertService;

    @RequestMapping("/info")
    public String overallAdvertInfo(Model model) {
        OverallAdvert overallAdvert = overallAdvertService.overallAdvertInfo();
        model.addAttribute("overallAdvert", overallAdvert);
        return resultPage("/planTools/overallAdvert/overallAdvertInfo");
    }

    @RequestMapping("/saveOverallAdvert")
    @ResponseBody
    public Map saveOverallAdvert(@RequestBody OverallAdvert entity) {
        return overallAdvertService.saveEntity(entity);
    }
}
